Conversation
recoveryKeyDeleteAndEmailNotification returned a value from its inner branches but not when recoveryKeyId was falsy. That was true before this change too, and it compiled only because the untyped old-mailer fallback widened the inferred return type to `any`, which suppresses TS7030. Removing the fallback removed the `any` and exposed the gap. The caller discards the value, so the branches now just await.
Contributor
There was a problem hiding this comment.
Pull request overview
Removes the obsolete canSend migration flag so auth-server email paths always use FxaMailer.
Changes:
- Removes the mailer flag and SMTP configuration.
- Deletes legacy-mailer fallback branches across routes and scripts.
- Updates affected mocks, fixtures, and tests.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
config/index.ts |
Removes obsolete SMTP flag. |
lib/inactive-accounts/index.ts |
Uses FxaMailer directly. |
lib/routes/account.ts |
Removes account email fallbacks. |
lib/routes/emails.js |
Removes secondary-email fallbacks. |
lib/routes/ip-profiling.spec.ts |
Updates mailer fixture setup. |
lib/routes/linked-accounts.spec.ts |
Removes flag mock resets. |
lib/routes/linked-accounts.ts |
Uses modern linked-account email. |
lib/routes/mfa.ts |
Uses modern MFA email. |
lib/routes/passkeys.spec.ts |
Removes flag-path tests. |
lib/routes/passkeys.ts |
Sends passkey emails directly. |
lib/routes/password.ts |
Removes password email fallbacks. |
lib/routes/recovery-codes.js |
Uses modern recovery-code emails. |
lib/routes/recovery-key.js |
Uses modern recovery-key emails. |
lib/routes/recovery-phone.ts |
Uses modern recovery-phone emails. |
lib/routes/session.js |
Removes session email fallbacks. |
lib/routes/totp.js |
Removes TOTP email fallbacks. |
lib/routes/unblock-codes.js |
Uses modern unblock-code email. |
lib/routes/unblock-codes.spec.ts |
Updates fixture documentation. |
lib/routes/utils/oauth.js |
Uses modern device-login email. |
lib/routes/utils/signin.js |
Removes sign-in email fallbacks. |
lib/routes/utils/signup.js |
Uses modern post-verification email. |
lib/senders/fxa-mailer.spec.ts |
Removes canSend tests. |
lib/senders/fxa-mailer.ts |
Removes canSend. |
scripts/recorded-future/check-and-reset.ts |
Removes legacy sender setup. |
scripts/verification-reminders.js |
Sends reminders through FxaMailer. |
test/fixtures/fxa-mailer.ts |
Removes default canSend mock. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Because
canSendwas a migration flag forlibs/email-sender. Every email goes through the new mailer now, and a rollback is off the table, so the flag and the old-mailer branches behind it are dead weight.elsebranch that sent through the old mailer. That branch became unreachable, so it goes with the flag.This pull request
canSendmethod fromFxaMailerinlib/senders/fxa-mailer.ts.smtp.fxaMailerDisableSendconfig block and itsSMTP_FXA_MAILER_DISABLE_SENDenv entry fromconfig/index.ts.lib/inactive-accounts/index.ts,scripts/verification-reminders.js, andscripts/recorded-future/check-and-reset.ts. The new mailer send stays; the old-mailerelsebranch goes.canSendtests and mocks, including the tests that only asserted the disabled or old-mailer path, infxa-mailer.spec.ts,passkeys.spec.ts, andtest/fixtures/fxa-mailer.ts.Issue that this pull request solves
Closes: https://mozilla-hub.atlassian.net/browse/FXA-13034
Checklist
Put an
xin the boxes that applyHow to review (Optional)
lib/senders/fxa-mailer.tsandconfig/index.tshold the actual removal. The rest is call-site unwrapping.fxaMailer.send*calls asmain.unblock-codes.jsalso loses adb.accountEmails(uid)call, andcheck-and-reset.tsloses itsbouncesFn/sendersFnsetup, because nothing but the old mailer used them.Screenshots (Optional)
Other information (Optional)
Operators should know that emails
SMTP_FXA_MAILER_DISABLE_SENDcould suppress can no longer be turned off by config. The escape hatch is gone, which is what the ticket asks for.AC 4 asks for the config value to go from the auth server and the admin server.
fxa-admin-serverhas no occurrence offxaMailerDisableSendorSMTP_FXA_MAILER_DISABLE_SEND, so there is nothing to remove there.Two follow-ups I did not do here:
mailerargument they are constructed with. Dropping that parameter means touching module signatures, call sites, and tests, which is wider than this ticket allows.totp.jsline 238 spreadsFxaMailerFormat.metricsContext(request)withoutawait, so the metrics fields never reachsendPostChangeTwoStepAuthenticationEmail. It predates this change and sits in the branch I kept. Every other call site awaits it.Local verification:
npx nx lint fxa-auth-serverpasses.account.spec.tshitsutil.isError is not a functionunder Node 24, andconfig/index.spec.tstrips on a localsnsTopicEndpointsetting. Neither is related to this change.git grep "canSend"returns onlycanSendToIOSinlib/push.js, which has nothing to do with the mailer.